package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;

/**
 * 按照指定的字符集
 */
public class WriteStringDemo3 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos=new FileOutputStream("demo.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        PrintWriter pw=new PrintWriter(osw);
        pw.println("急急急急急急结算单");
        pw.println("点击观看快点快点两三年");
        pw.println("肯德基发货那个快点快点");
        System.out.println("写入完成");
        pw.close();
    }
}
